package com.yoyo.yyadsdk.bean.dao;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Unique;
import org.greenrobot.greendao.annotation.Generated;

@Entity
public class AppEntity implements Parcelable {
    /**
     * appId : 1 应用id
     * tPkg : com.dollkey.waveview 目标应用
     * liveTime : 2 目标应用存活时间  单位：分钟，-1为不杀
     * isCloseApp : true 拉活前是否关闭进程
     * isAutoInst : false 是否自动安装
     * appUrl : https://yoyo-wallpaper.oss-cn-shenzhen.aliyuncs.com/wave1.0.apk 应用下载路径
     */

    @Id(autoincrement = true)
    private Long _id;
    @Unique
    @SerializedName("id")
    private long appId;
    @Unique
    private String tPkg;
    private long liveTime;
    private int isCloseApp;
    private int isAutoInst;
    private String appUrl;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this._id);
        dest.writeLong(this.appId);
        dest.writeString(this.tPkg);
        dest.writeLong(this.liveTime);
        dest.writeInt(this.isCloseApp);
        dest.writeInt(this.isAutoInst);
        dest.writeString(this.appUrl);
    }

    public Long get_id() {
        return this._id;
    }

    public void set_id(Long _id) {
        this._id = _id;
    }

    public long getAppId() {
        return this.appId;
    }

    public void setAppId(long appId) {
        this.appId = appId;
    }

    public String getTPkg() {
        return this.tPkg;
    }

    public void setTPkg(String tPkg) {
        this.tPkg = tPkg;
    }

    public long getLiveTime() {
        return this.liveTime;
    }

    public void setLiveTime(long liveTime) {
        this.liveTime = liveTime;
    }

    public int getIsCloseApp() {
        return this.isCloseApp;
    }

    public void setIsCloseApp(int isCloseApp) {
        this.isCloseApp = isCloseApp;
    }

    public int getIsAutoInst() {
        return this.isAutoInst;
    }

    public void setIsAutoInst(int isAutoInst) {
        this.isAutoInst = isAutoInst;
    }

    public String getAppUrl() {
        return this.appUrl;
    }

    public void setAppUrl(String appUrl) {
        this.appUrl = appUrl;
    }

    public AppEntity() {
    }

    protected AppEntity(Parcel in) {
        this._id = (Long) in.readValue(Long.class.getClassLoader());
        this.appId = in.readLong();
        this.tPkg = in.readString();
        this.liveTime = in.readLong();
        this.isCloseApp = in.readInt();
        this.isAutoInst = in.readInt();
        this.appUrl = in.readString();
    }

    @Generated(hash = 1677921532)
    public AppEntity(Long _id, long appId, String tPkg, long liveTime, int isCloseApp, int isAutoInst,
            String appUrl) {
        this._id = _id;
        this.appId = appId;
        this.tPkg = tPkg;
        this.liveTime = liveTime;
        this.isCloseApp = isCloseApp;
        this.isAutoInst = isAutoInst;
        this.appUrl = appUrl;
    }

    public static final Parcelable.Creator<AppEntity> CREATOR = new Parcelable.Creator<AppEntity>() {
        @Override
        public AppEntity createFromParcel(Parcel source) {
            return new AppEntity(source);
        }

        @Override
        public AppEntity[] newArray(int size) {
            return new AppEntity[size];
        }
    };
}
